<!DOCTYPE html>
<html lang="zh-CN">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <body>
    <h1>对象动态key属性</h1>
    <script>
      const obj = {
        aa: 11,
        ['bb' + 'cc']: 22,
      }
      console.log(obj) //  {aa:11,bbcc:22}


      const obj2 = {
        url: 'xxxx',
        [true ? 'params' : 'data']: '请求参数',
      }
      console.log(obj2) // {url: 'xxxx', params: '请求参数'}
    </script>
  </body>
</html>
